<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<link href="<?php echo __PUBLIC__?>/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	<!--<link rel="stylesheet" href="__PUBLIC__/Css/common.css" />-->
	<script type="text/javascript" src='<?php echo __PUBLIC__?>/jquery-1.7.2.min.js'></script>
	<style type="text/css">
		body{
			margin-bottom: 100px;
		}
	</style>
</head>
<body>
	<div class="container-fluid">
	<div class="row-fluid">
	<div class="span12">

	
	<form action="" method='post'>
	
		<table class='table table-bordered table-hover'>
			
			<tr>
				<th>货品ID</th>
				<?php foreach ($title as $k=>$v){?>
				<th><?php echo $k?></th>
				<?php }?>
				<th>库存</th>
				<th>货号</th>
				<th>操作</th>
			</tr>
			
			<?php foreach ($gldata as $v){?>
				<tr class="info">
					<td><?php echo $v['glid']?></td>
					<?php foreach ($v['gavalue'] as $vv){?>
					<td><?php echo $vv?></td>
					<?php }?>
					<td><?php echo $v['inventory']?></td>
					<td><?php echo $v['number']?></td>
					<td>
						<a href="<?php echo U('edit',array('gid'=>$v['goods_gid'],'glid'=>$v['glid']))?>" class="btn btn-warning"><i class="icon-pencil icon-white"></i>修改</a>
						<a href="<?php echo U('del',array('gid'=>$v['goods_gid'],'glid'=>$v['glid']))?>" class="btn btn-danger"><i class="icon-trash icon-white"></i>删除</a>
					</td>
				</tr>
			<?php }?>

			<!-- 如果已添加数目小于可能情况数目，才出现添加货品的输入框 -->
			
			<tr class="info">
				<td>添加货品</td>
		
					<?php foreach ($title as $k=>$v){?>
					<td>
						<select name="combine[]">
							<option value="0">-请选择-</option>
								<?php foreach ($v as $vk=>$vv){?>
								<option value="<?php echo $vv['gaid']?>"><?php echo $vv['gavalue']?></option>
								<?php }?>
						</select>
					</td>
					<?php }?>

				<td>
					<input type="text" name='inventory'/>
				</td>
				<td>
					<input type="text" name='number' value="" />
				</td>
				<td></td>
			</tr>
			</if>
		</table>

		<?php foreach ($title as $k=>$v){?>
		<?php foreach ($v as $vk=>$vv){?>
			<input type="hidden" name='goods_gid' value="<?php echo $vv['goods_gid']?>"/>
			
			<!--<input type="hidden" name='type_tid' value="<?php echo $vv['type_tid']?>"/>-->
		<?php }?>
		<?php }?>
		<input type="submit" value='保存添加' class="btn btn-primary"/>
	</form>
	

	</div>
	</div>
	</div>



</body>
</html>